import UserService from '../service/user-service';
import * as Koa from 'koa';
/**
 * User controller.
 * This api used for CURD to user info.
 */
class UserController {
  private service: UserService = new UserService();

  // 添加用户
  addUser = async (ctx: Koa.Context) => {
    await this.service.addUser(ctx);
  };

  // 删除用户
  delUser = async (ctx: Koa.Context) => {
    await this.service.delUser(ctx);
  };

  // 修改用户
  updateUser = async (ctx: Koa.Context) => {
    await this.service.updateUser(ctx);
  };

  // 查询用户
  searchUser = async (ctx: Koa.Context) => {
    await this.service.searchUser(ctx);
  };

  // web端登录用户
  webUserInfo = async (ctx: Koa.Context) => {
    await this.service.webUserInfo(ctx);
  };
  webUserLogin = async (ctx: Koa.Context) => {
    await this.service.webUserLogin(ctx);
  };
  webUserSendCode = async (ctx: Koa.Context) => {
    await this.service.webUserSendCode(ctx);
  };
  webUserRegister = async (ctx: Koa.Context) => {
    await this.service.webUserRegister(ctx);
  };

  appletGetToken = async (ctx: Koa.Context) => {
    await this.service.appletGetToken(ctx);
  };
  appeltUserCheckToken = async (ctx: Koa.Context) => {
    await this.service.appeltUserCheckToken(ctx);
  };
  appletUserLogin = async (ctx: Koa.Context) => {
    await this.service.appletUserLogin(ctx);
  };
  appletGetUserInfo = async (ctx: Koa.Context) => {
    await this.service.appletGetUserInfo(ctx);
  };
}

export default new UserController();
